#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    qDebug()<<"here";
    // ui->buttonGroup->button(0)->setChecked(1);
}

void Widget::on_SelectButton_clicked(){
    // 获取当前选中的按钮
    QAbstractButton *selectedButton = ui->buttonGroup->checkedButton();

    if (selectedButton) {
        // 输出被选中的按钮的文本
        if(selectedButton == ui->nameAndPasswordButton){
            qDebug() << "nameAndPasswordButton selected";
        }
        else if(selectedButton == ui->basicInformationButton){
            qDebug() << "basicInformationButton selected";
        }
        else if(selectedButton == ui->medicalHistoryButton){
            qDebug() << "medicalHistoryButton selected";
        }
        else if(selectedButton == ui->reservationButton){
            qDebug() << "reservationButton selected";
        }
        else if(selectedButton == ui->medicalHistoryButton){
            qDebug() << "medicalHistoryButton selected";
        }
        else if(selectedButton == ui->detailsButton){
            qDebug() << "detailsButton selected";
        }
        else if(selectedButton == ui->medicalHistoryButton){
            qDebug() << "medicalHistoryButton selected";
        }
    } else {
        // 如果没有按钮被选中
        qDebug() << "No button is selected.";
    }
}

Widget::~Widget()
{
    delete ui;
}
